<template>
	<view class="leave-box" style="padding: 0 15rpx 0 10rpx;">
		<!-- <loadMore :onLoadMore="onLoadMore" :loadMore="loadMore"> -->
		<view class="leave-content" @click="DetailsBtn(item.leave_id)" v-for="(item,index) in leaveList" :key="index">
			<view class="leave-content-left">
				<view class="leave-content-left-top" v-if="item">
					<view class="leave-content-name" v-if="item">{{item.name}}</view>
					<view class="leave-content-classnumber" v-if="item">学号：{{item.sno}}</view>
				</view>
				<view class="leave-content-time">
					<view class="leave-tiem" v-if="item">请假时间：（总时长{{item.hours}}小时）</view>
					<view class="leave-date" v-if="item">{{item.begintime?item.begintime.substring(0,16):''}} 至 
																							 {{item.endtime?item.endtime.substring(0,16):''}}</view>
				</view>
			</view>
			<view class="leave-content-right">
				<!-- <view class="leave-content-right-box">请假申请</view> -->
				<button class="button_status" style="color: #77312A;">请假申请</button>
			</view>
		</view>
		<!-- </loadMore> -->
	</view>

</template>

<script>
	import loadMore from "@/pages/components/loadmore.vue"
	export default {
		data() {
			return {
				name: '李四',
				id: '0000000001',
				//首页信息列表
				leaveList: [],
				isShow: false,
				//分页
				page: 1,
				loadMore: true,
			}
		},
		mounted() {
			this.getData()
		},
		components: {
			loadMore
		},
		methods: {
			DetailsBtn(id) {
				console.log('11111')
				console.log(id)
				uni.navigateTo({
					url: '/pages/leaveinfo/leaveinfo?id=' + id
				});

			},
			onLoadMore(done) {
				setTimeout(() => {
					if (!this.enableLoadMore) {
						return
					}
					this.page = this.page + 1
					this.getData();
					done();
				}, 200)
			},

			getData() {
				// 请求接口 ↓↓↓
				//请求首页数据
				uni.request({
					// url: "/api/appteacher/searchIndexDataOfTeacher",
					url: this.baseUrl+ "/appteacher/searchIndexDataOfTeacher?satoken="+uni.getStorageSync('satoken'),
					method: "POST",
					headers: {
						// "token": localStorage.getItem("token")
					},
					data: {
						page: this.page,
						length: '50'
					},
					success: (res) => {
						console.log(res)
						this.leaveList = res.data.page.list
					}
				})
			}

		}



	}
</script>
<style lang="scss">
	@import url('../../static/common.css');
/* 	.leave-box {
		width: 100%;
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		align-items: center;
		justify-content: center;
		color: #707070;

		.leave-content {
			width: 100%;
			display: flex;
			box-sizing: border-box;
			background-color: #ffffff;
			flex-direction: row;
			align-items: center;
			margin-top: 30rpx;
			padding: 30rpx 0;
			padding-left: 20rpx;
			border-bottom: 1rpx solid #999999;

			.leave-content-left {
				flex: 2;
				display: flex;
				flex-direction: column;

				.leave-content-left-top {
					display: flex;
					flex-direction: row;
					font-size: 28rpx;

					.leave-content-name {
						margin-right: 30rpx;
					}
				}

				.leave-content-time {
					font-size: 24rpx;
					display: flex;
					flex-direction: column;
					margin-top: 20rpx;

					.leave-tiem {

						margin-bottom: 10rpx;
					}

					.leave-date {
						letter-spacing: 1rpx;
					}

				}

			}

			.leave-content-right {
				flex: 1;

				.leave-content-right-box {
					width: 200rpx;
					height: 100rpx;
					background-color: #f5f5f5;
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 28rpx;
				}

			}
		}


	} */
</style>
